from tkinter import font
import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['svg.fonttype'] = 'none'

# 创建数据框架
data = {
    'Node Nums': [40, 80, 120, 160, 200, 240, 280, 320],
    'SPS': [159.6,
  49.36363636363637,
  36.2,
  24.666666666666668,
  19.833333333333332,
  20.8,
  15.8,
  19.833333333333332],
    'OGS': [242.0, 127.4, 83.6, 90.4, 52.6, 55.333333333333336, 37.4, 31.0],
    'ORDP': [22.70301414465743,
  19.4,
  21.4,
  11.642857142857142,
  15.25,
  14.777777777777779,
  21.833333333333332,
  14.0],
}

df = pd.DataFrame(data)

# 绘制数据
plt.figure(figsize=(8, 6))
plt.plot(df['Node Nums'], df['SPS'], marker='s', markersize=10, label='SPS')
plt.plot(df['Node Nums'], df['OGS'], marker='^', markersize=10, label='OGS')
plt.plot(df['Node Nums'], df['ORDP'], marker='*', markersize=10, label='ORDP')

# plt.title('Comparison of SPF and Cplex Algorithms')
plt.xlabel('Number of Nodes', fontsize=14)
plt.ylabel('Congestion Ratio', fontsize=14)
plt.legend(fontsize='large')  # 设置图例的字体大小为大

plt.grid(True)
# plt.show()
plt.savefig("output/cr.svg", format="svg")
